package com.rex.task;

import org.apache.log4j.Logger;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;

/**
 * Created by frt on 2017/11/2.
 * 定时器
 */
@Component
public class SampleTask {
    Logger logger = Logger.getLogger(SampleTask.class);
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    @Scheduled(fixedRate = 5000)
    public void reportCurrentTime(){
        //logger.debug("Current time:" + sdf.format(new Date()));
    }

}
